{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "7a4aad7e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import random\n",
    "import tempfile\n",
    "\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "from sklearn.linear_model import LogisticRegression\n",
    "\n",
    "import truss\n",
    "\n",
    "# 10 rows of 10 features\n",
    "features = random.choices(range(10), k=10)\n",
    "values = np.random.randint(0, 100, size=(10, 10))\n",
    "\n",
    "df = pd.DataFrame(values, columns=features)\n",
    "\n",
    "lr = LogisticRegression(random_state=0, max_iter=1000)\n",
    "lr.fit(df.values, df.iloc[:, 0])\n",
    "\n",
    "with tempfile.TemporaryDirectory() as tmp:\n",
    "    tr = truss.create(lr, target_directory=tmp)\n",
    "\n",
    "    assert truss.load(tmp).spec.yaml_string == tr.spec.yaml_string"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
